<?php
require_once dirname(__FILE__) . '/Components.php';

class Smarty_Components_Thickbox extends Smarty_Components
{
	static public $JS_USED;
	static public $CSS_USED;

	const TEMPLATE_NAME_CSS = 'thickboxCss.tpl';
	const TEMPLATE_NAME_JS = 'thickboxJs.tpl';
	const TEMPLATE_NAME = 'thickbox.tpl';

	public function __construct($sCompileDir, $sCompileId) {
		parent::__construct(dirname(__FILE__), $sCompileDir, $sCompileId);
	}

	public function fetch($LINIK, $WIDTH, $HEIGHT, $TEXT, $EXTPRM='')
	{
		$this->view->LINIK = $LINIK;
		$this->view->WIDTH = $WIDTH;
		$this->view->HEIGHT = $HEIGHT;
		$this->view->TEXT = $TEXT;
		$this->view->EXTPRM = $EXTPRM;
		$sHtml = parent::fetch(self::TEMPLATE_NAME);
		return $sHtml;
	}

	public function fetchCss()
	{
		if ( self::$CSS_USED === TRUE ) {
			return '';
		}
		self::$CSS_USED = TRUE;
		$sHtml = parent::fetch(self::TEMPLATE_NAME_CSS);
		return $sHtml;
	}

	public function fetchJs()
	{
		if ( self::$JS_USED === TRUE ) {
			return '';
		}
		self::$JS_USED = TRUE;
		$sHtml = parent::fetch(self::TEMPLATE_NAME_JS);
		return $sHtml;
	}
}